﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Webdiyer.WebControls.Mvc;
using Zor_Bll;
using Zor_Modes;
using Zor_Tools;
using Zor_Web.Models.Browse;

namespace Zor_Web.Controllers
{
    [Authorization]
    public class BrowseController : Controller
    {
        //
        // GET: /Browse/

        #region - 楼宇浏览 -
        /// <summary>
        /// 楼宇浏览
        /// create by Guoph at 2017.3.27
        /// </summary>
        /// <param name="index"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public ActionResult BuildingBrowse(V_BuildingBrowse Model, int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;

            PagedList<V_BuildingBrowse> rsPager = BuildingBrowse_Bll<V_BuildingBrowse>.GetPageList(Model,pageIndex, out totalCount, where).AsQueryable().ToPagedList(0, 10) as PagedList<V_BuildingBrowse>;
            rsPager.TotalItemCount = totalCount;
            rsPager.CurrentPageIndex = (int)(index ?? 1);

            V_BuildingBrowse vr = new V_BuildingBrowse();
            vr.PageData = rsPager;
            return View(vr);
        }
        #endregion

        #region - 房屋浏览 -
        /// <summary>
        /// 房屋浏览
        /// create by Guoph at 2017.3.27
        /// </summary>
        /// <param name="index"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public ActionResult HousingBrowse(V_HousingBrowse Model, int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;
            PagedList<V_HousingBrowse> rsPager = HousingBrowse_Bll<V_HousingBrowse>.GetPageList(Model,pageIndex, out totalCount, where).AsQueryable().ToPagedList(0, 10) as PagedList<V_HousingBrowse>;
            rsPager.TotalItemCount = totalCount;
            rsPager.CurrentPageIndex = (int)(index ?? 1);

            V_HousingBrowse vr = new V_HousingBrowse();
            vr.PageData = rsPager;
            TempData["QueryConditions"] = Model;//给导出数据传查询条件
            return View(vr);
        }

        /// <summary>
        /// 房屋浏览导出
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        public FileResult ExportHousingBrowse(FormCollection form)
        {
            string HousingMeg = form["HousingBrowseMeg"];
            string where = form["where"];
            string[] str_arr = HousingMeg.Split(',');
            NoSortHashTable nameList = new NoSortHashTable();

            for (int i = 0; i < str_arr.Length; i++)
            {
                if (str_arr[i] != "")
                {
                    string[] item = str_arr[i].Split('|');
                    nameList.Add(item[0], item[1]);
                }
            }

            #region 拼接table

            System.Text.StringBuilder data = new System.Text.StringBuilder();
            if (nameList != null)
            {
                data.Append("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\">");
                //写出列名
                data.Append("<tr style=\"font-weight: bold; white-space: nowrap;\">");


                foreach (string s in nameList.Keys)
                {
                    data.Append("<td>" + nameList[s] + "</td>");
                }
                data.Append("</tr>");

                List<V_HousingBrowse> list = HousingBrowse_Bll<V_HousingBrowse>.GetHousingBrowseList((V_HousingBrowse)TempData["QueryConditions"], where);
                //写出数据
                foreach (V_HousingBrowse model in list)
                {
                    data.Append("<tr>");
                    foreach (string sm in nameList.Keys)
                    {
                        switch (sm)
                        {
                            case "Community": data.Append("<td>" + model.Community + "</td>"); ; break;
                            case "Bd_Name": data.Append("<td>" + model.Bd_Name + "</td>"); ; break;
                            case "Uim_Name": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Uim_Name + "</td>"); ; break;
                            case "Hs_Number":
                                if (model.Hs_Number != null)
                                {
                                    data.Append("<td>" + model.Hs_Number.ToString() + "</td>"); ; break;
                                }
                                else
                                {
                                    data.Append("<td></td>"); ; break;
                                }
              
                            case "NatPer_Name": data.Append("<td>" + model.NatPer_Name + "</td>"); ; break;
                            case "NatPer_IDNumber": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.NatPer_IDNumber + "</td>"); ; break;
                            case "NatPer_Phone": data.Append("<td>" + model.NatPer_Phone + "</td>"); ; break;
                            case "NatPer_Sex": data.Append("<td>" + model.NatPer_Sex + "</td>"); ; break;

                            case "Hs_Proportion": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Hs_Proportion.ToString() + "</td>"); ; break;
                            case "Hs_Cqsx": data.Append("<td>" + model.Hs_Cqsx + "</td>"); ; break;
                            case "Hsattribute": data.Append("<td>" + model.Hsattribute + "</td>"); ; break;
                            case "HsHousUse": data.Append("<td>" + model.HsHousUse + "</td>"); ; break;
                            case "Hs_household": data.Append("<td>" + model.Hs_household.ToString() + "</td>"); ; break;
                            
                        }
                    }
                    data.Append("</tr>");
                }
                data.Append("</table>");
            }
            #endregion

            string sw = ExcelHelper.ExcelTemplate(data.ToString());

            string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
            // 写入到数据流
            return File(System.Text.Encoding.UTF8.GetBytes(sw.ToString()), "application/octet-stream", "房屋信息浏览清单_" + fileName + ".xls");

        }
        #endregion

        #region - 商铺浏览 -
        /// <summary>
        /// 商铺浏览
        /// create by Guoph at 2017.3.28
        /// </summary>
        /// <param name="index"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public ActionResult ShopsBrowse(V_ShopsBrowse Model,int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;
            PagedList<V_ShopsBrowse> rsPager = ShopsBrowse_Bll<V_ShopsBrowse>.GetPageList(Model,pageIndex, out totalCount, where).AsQueryable().ToPagedList(0, 10) as PagedList<V_ShopsBrowse>;
            rsPager.TotalItemCount = totalCount;
            rsPager.CurrentPageIndex = (int)(index ?? 1);

            V_ShopsBrowse vr = new V_ShopsBrowse();
            vr.PageData = rsPager;
            TempData["QueryConditions"] = Model;//给导出数据传查询条件
            return View(vr);
        }

        /// <summary>
        /// 商铺浏览导出
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        public FileResult ExportShopsBrowse(FormCollection form)
        {
            string HousingMeg = form["ShopsBrowseMeg"];
            string where = form["where"];
            string[] str_arr = HousingMeg.Split(',');
            NoSortHashTable nameList = new NoSortHashTable();

            for (int i = 0; i < str_arr.Length; i++)
            {
                if (str_arr[i] != "")
                {
                    string[] item = str_arr[i].Split('|');
                    nameList.Add(item[0], item[1]);
                }
            }

            #region 拼接table

            System.Text.StringBuilder data = new System.Text.StringBuilder();
            if (nameList != null)
            {
                data.Append("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\">");
                //写出列名
                data.Append("<tr style=\"font-weight: bold; white-space: nowrap;\">");


                foreach (string s in nameList.Keys)
                {
                    data.Append("<td>" + nameList[s] + "</td>");
                }
                data.Append("</tr>");

                List<V_ShopsBrowse> list = ShopsBrowse_Bll<V_ShopsBrowse>.GetShopsBrowseList((V_ShopsBrowse)TempData["QueryConditions"], where);
                //写出数据
                foreach (V_ShopsBrowse model in list)
                {
                    data.Append("<tr>");
                    foreach (string sm in nameList.Keys)
                    {
                        switch (sm)
                        {
                            case "Community": data.Append("<td>" + model.Community + "</td>"); ; break;
                            case "Bd_Name": data.Append("<td>" + model.Bd_Name + "</td>"); ; break;
                            case "Uim_Name": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Uim_Name + "</td>"); ; break;
                            case "Hs_Number":
                                if (model.Hs_Number != null)
                                {
                                    data.Append("<td>" + model.Hs_Number.ToString() + "</td>"); ; break;
                                }
                                else
                                {
                                    data.Append("<td></td>"); ; break;
                                }

                            case "NatPer_Name": data.Append("<td>" + model.NatPer_Name + "</td>"); ; break;
                            case "NatPer_IDNumber": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.NatPer_IDNumber + "</td>"); ; break;
                            case "NatPer_Phone": data.Append("<td>" + model.NatPer_Phone + "</td>"); ; break;
                            case "NatPer_Sex": data.Append("<td>" + model.NatPer_Sex + "</td>"); ; break;

                            case "Hs_Proportion": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Hs_Proportion.ToString() + "</td>"); ; break;                           
                            case "HsHousUse": data.Append("<td>" + model.HsHousUse + "</td>"); ; break;
                        
                        }
                    }
                    data.Append("</tr>");
                }
                data.Append("</table>");
            }
            #endregion

            string sw = ExcelHelper.ExcelTemplate(data.ToString());

            string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
            // 写入到数据流
            return File(System.Text.Encoding.UTF8.GetBytes(sw.ToString()), "application/octet-stream", "商铺信息浏览清单_" + fileName + ".xls");

        }
        #endregion

        #region - 租户[个人]浏览 -
        /// <summary>
        /// 租户[个人]浏览
        /// create by Guoph at 2017.3.28
        /// </summary>
        /// <param name="index"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public ActionResult TenantPersonHousBrowse(V_TenantPersonHousBrowse Model, int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;
            PagedList<V_TenantPersonHousBrowse> rsPager = TenantPersonHousBrowse_Bll<V_TenantPersonHousBrowse>.GetPageList(Model, pageIndex, out totalCount, where).AsQueryable().ToPagedList(0, 10) as PagedList<V_TenantPersonHousBrowse>;
            rsPager.TotalItemCount = totalCount;
            rsPager.CurrentPageIndex = (int)(index ?? 1);
            V_TenantPersonHousBrowse vr = new V_TenantPersonHousBrowse();
            vr.PageData = rsPager;
            return View(vr);
        }
        #endregion

        #region - 租户[企业]浏览 -
        /// <summary>
        /// 租户[企业]浏览
        /// create by Guoph at 2017.3.28
        /// </summary>
        /// <param name="index"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public ActionResult TenantCompanyHousBrowse(V_TenantCompanyHousBrowse Model,int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;
            PagedList<V_TenantCompanyHousBrowse> rsPager = TenantCompanyHousBrowse_Bll<V_TenantCompanyHousBrowse>.GetPageList(Model,pageIndex, where,out totalCount).AsQueryable().ToPagedList(0, 10) as PagedList<V_TenantCompanyHousBrowse>;
            rsPager.TotalItemCount = totalCount;
            rsPager.CurrentPageIndex = (int)(index ?? 1);
            V_TenantCompanyHousBrowse vr = new V_TenantCompanyHousBrowse();
            vr.PageData = rsPager;
            return View(vr);
        }
        #endregion

        #region - 租赁浏览 -
        /// <summary>
        /// 租赁浏览
        /// create by Guoph at 2017.3.28
        /// </summary>
        /// <param name="index"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public ActionResult LeaseBrowse(V_LeaseBrowse Model, int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;
            PagedList<V_LeaseBrowse> rsPager = LeaseBrowse_Bll<V_LeaseBrowse>.GetPageList(Model, pageIndex, out totalCount, where).AsQueryable().ToPagedList(0, 10) as PagedList<V_LeaseBrowse>;
            rsPager.TotalItemCount = totalCount;
            rsPager.CurrentPageIndex = (int)(index ?? 1);
            V_LeaseBrowse vr = new V_LeaseBrowse();
            vr.PageData = rsPager;
            return View(vr);
        }
        #endregion

        #region - 受理单浏览 -
        /// <summary>
        /// 租赁浏览
        /// create by Guoph at 2017.3.29
        /// </summary>
        /// <param name="index"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public ActionResult AcceptanceBrowse(V_AcceptanceBrowse Model,int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;
            PagedList<V_AcceptanceBrowse> rsPager = AcceptanceBrowse_Bll<V_AcceptanceBrowse>.GetPageList(Model,pageIndex, out totalCount,where).AsQueryable().ToPagedList(0, 10) as PagedList<V_AcceptanceBrowse>;
            rsPager.TotalItemCount = totalCount;
            rsPager.CurrentPageIndex = (int)(index ?? 1);
            V_AcceptanceBrowse vr = new V_AcceptanceBrowse();
            vr.PageData = rsPager;
            return View(vr);
        }
        #endregion

        #region - 税收浏览 -
        /// <summary>
        /// 租赁浏览
        /// create by Guoph at 2017.3.30
        /// </summary>
        /// <param name="index"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public ActionResult PayTaxesBrowse(V_PayTaxesBrowse Model,int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;
            PagedList<V_PayTaxesBrowse> rsPager = PayTaxesBrowse_Bll<V_PayTaxesBrowse>.GetPageList(Model,pageIndex, out totalCount, where).AsQueryable().ToPagedList(0, 10) as PagedList<V_PayTaxesBrowse>;
            rsPager.TotalItemCount = totalCount;
            rsPager.CurrentPageIndex = (int)(index ?? 1);
            V_PayTaxesBrowse vr = new V_PayTaxesBrowse();
            vr.PageData = rsPager;
            TempData["QueryConditions"] = Model;//给导出数据传查询条件
            return View(vr);
        }

        /// <summary>
        /// 获取社区下拉列表
        /// </summary>
        /// <returns></returns>
        public ActionResult SelectCommunity()
        {
            List<Sys_Department> listNode = PayTaxesBrowse_Bll<Sys_Department>.SelectCommunity();
            return Content(listNode.ToJson());
        }

        /// <summary>
        /// 获取街道办下拉
        /// </summary>
        /// <returns></returns>
        public ActionResult SelectStreetOffice()
        {
            List<Sys_Department> listNode = PayTaxesBrowse_Bll<Sys_Department>.SelectStreetOffice();
            return Content(listNode.ToJson());
        }

        /// <summary>
        /// 税收导出
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        public FileResult ExportPayTaxesBrowse(FormCollection form)
        {
            string PayTaxesBrowseMeg = form["PayTaxesBrowseMeg"];
            string where = form["where"];
            string[] str_arr = PayTaxesBrowseMeg.Split(',');
            NoSortHashTable nameList = new NoSortHashTable();

            for (int i = 0; i < str_arr.Length; i++)
            {
                if (str_arr[i] != "")
                {
                    string[] item = str_arr[i].Split('|');
                    nameList.Add(item[0], item[1]);
                }
            }

            #region 拼接table

            System.Text.StringBuilder data = new System.Text.StringBuilder();
            if (nameList != null)
            {
                data.Append("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\">");
                //写出列名
                data.Append("<tr style=\"font-weight: bold; white-space: nowrap;\">");


                foreach (string s in nameList.Keys)
                {
                    data.Append("<td>" + nameList[s] + "</td>");
                }
                data.Append("</tr>");

                List<V_PayTaxesBrowse> list = PayTaxesBrowse_Bll<V_PayTaxesBrowse>.GetPayTaxesBrowseList((V_PayTaxesBrowse)TempData["QueryConditions"], where);
                //写出数据
                foreach (V_PayTaxesBrowse model in list)
                {
                    data.Append("<tr>");
                    foreach (string sm in nameList.Keys)
                    {
                        switch (sm)
                        {
                            case "Community": data.Append("<td>" + model.Community + "</td>"); ; break;
                            case "Bd_address": data.Append("<td>" + model.Acceptance_Address+ "</td>"); ; break;
                            case "Hs_Proportion": data.Append("<td>" + model.Hs_Proportion + "</td>"); ; break;
                            case "Attribute": data.Append("<td>" + model.Hs_attribute + "</td>"); ; break;
                            case "NatPer_Name": data.Append("<td>" + model.NatPer_Name + "</td>"); ; break;
                            case "NatPer_Phone": data.Append("<td>" + model.NatPer_Phone + "</td>"); ; break;

                            case "Lease_Rent": data.Append("<td>" + model.Lease_Rent*0.01 + "</td>"); ; break;
                            case "Tenant_Name": data.Append("<td>" + model.Tenant_Name + "</td>"); ; break;
                            case "Tenant_Phone": data.Append("<td>" + model.Tenant_Phone + "</td>"); ; break;
                            case "Acceptance_TaxStartTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Acceptance_TaxStartTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Acceptance_TaxEndTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Acceptance_TaxEndTime.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Acceptance_TicketNumber": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Acceptance_TicketNumber + "</td>"); ; break;

                            case "Acceptance_PropertyTax": data.Append("<td>" + model.Acceptance_PropertyTax*0.01 + "</td>"); ; break;
                            case "Acceptance_PersonalTax": data.Append("<td>" + model.Acceptance_PersonalTax*0.01 + "</td>"); ; break;
                            case "Acceptance_Tax": data.Append("<td>" + model.Acceptance_Tax*0.01 + "</td>"); ; break;
                            case "Review_Tax": data.Append("<td>" + model.Review_Tax*0.01 + "</td>"); ; break;
                            case "Review_Date": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Review_Date.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Review_Comment": data.Append("<td>" + model.Review_Comment + "</td>"); ; break;

                            case "Evaluate_Tax": data.Append("<td>" + model.Evaluate_Tax*0.01 + "</td>"); ; break;
                            case "Evaluate_Date": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Evaluate_Date.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Evaluate_Comment": data.Append("<td>" + model.Evaluate_Comment + "</td>"); ; break;
                            case "Examine_Date": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Examine_Date.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                            case "Examine_Comment": data.Append("<td>" + model.Examine_Comment + "</td>"); ; break;
                            case "Pt_Date":
                                if (model.Pt_Date != null)
                                {
                                    data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Pt_Date.ToString(), TimeHelper.ToTimeType.link_ymd) + "</td>"); ; break;
                                }
                                else
                                {
                                    data.Append("<td></td>"); ; break;
                                }

                            case "Pt_ActualTax": data.Append("<td>" + model.Pt_ActualTax*0.01 + "</td>"); ; break;
                            case "Pt_CertificateNumber": data.Append("<td>" + model.Pt_CertificateNumber + "</td>"); ; break;
                            case "PtState": data.Append("<td>" + model.PtState + "</td>"); ; break;

                        }
                    }
                    data.Append("</tr>");
                }
                data.Append("</table>");
            }
            #endregion

            string sw = ExcelHelper.ExcelTemplate(data.ToString());

            string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
            // 写入到数据流
            return File(System.Text.Encoding.UTF8.GetBytes(sw.ToString()), "application/octet-stream", "缴税信息浏览_" + fileName + ".xls");

        }
        #endregion

        private static string strWhere = "";
        #region - 一户式纳税情况表 -
        /// <summary>
        /// 一户式纳税情况表
        /// create by Guoph at 2017.4.10
        /// </summary>
        /// <param name="index"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public ActionResult AHouseholdTax(int? index = 1, string where = null)
        {
            int totalCount = 0;
            int pageIndex = index ?? 1;
            PagedList<V_AHouseholdTax> rsPager = AHouseholdTax_Bll<V_AHouseholdTax>.GetPageList(pageIndex, out totalCount, where).AsQueryable().ToPagedList(0, 10) as PagedList<V_AHouseholdTax>;
            rsPager.TotalItemCount = totalCount;
            rsPager.CurrentPageIndex = (int)(index ?? 1);
            V_AHouseholdTax vr = new V_AHouseholdTax();
            strWhere=where;
            vr.PageData = rsPager;          
            return View(vr);
        }
           
        /// <summary>
        /// 导出一户式纳税情况表
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        public FileResult AHouseholdTaxMeg(FormCollection form)
        {
            
            string AHouseholdTaxMeg = form["AHouseholdTaxMeg"];
            string where = strWhere;// form["whereExport"];
            string[] str_arr = AHouseholdTaxMeg.Split(',');
            NoSortHashTable nameList = new NoSortHashTable();

            for (int i = 0; i < str_arr.Length; i++)
            {
                if (str_arr[i] != "")
                {
                    string[] item = str_arr[i].Split('|');
                    nameList.Add(item[0], item[1]);
                }
            }

            #region 拼接table

            System.Text.StringBuilder data = new System.Text.StringBuilder();
            if (nameList != null)
            {
                data.Append("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\">");
                //写出列名
                data.Append("<tr style=\"font-weight: bold; white-space: nowrap;\">");

                foreach (string s in nameList.Keys)
                {
                    data.Append("<td>" + nameList[s] + "</td>");
                }
                data.Append("</tr>");              
                List<V_AHouseholdTax> list = AHouseholdTax_Bll<V_AHouseholdTax>.GetList(where);
                //写出数据
                foreach (V_AHouseholdTax model in list)
                {
                    data.Append("<tr>");
                    foreach (string sm in nameList.Keys)
                    {
                        switch (sm)
                        {
                            case "Acceptance_TicketNumber": data.Append("<td>" + model.Acceptance_TicketNumber + "</td>"); ; break;
                            case "Pt_CertificateNumber": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Pt_CertificateNumber + "</td>"); ; break;
                            case "In_Number": data.Append("<td>" + model.In_Number + "</td>"); ; break;
                            case "Hs_attribute": data.Append("<td>" + model.Hs_attribute + "</td>"); ; break;
                            case "Lease_Rent": data.Append("<td>" + model.Lease_Rent*0.01 + "</td>"); ; break;
                            case "Hs_Proportion": data.Append("<td style='vnd.ms-excel.numberformat:@'>" + model.Hs_Proportion + "</td>"); ; break;
                            case "Acceptance_TaxStartTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Acceptance_TaxStartTime.ToString(), TimeHelper.ToTimeType.link_ymdt) + "</td>"); ; break;
                            case "Acceptance_TaxEndTime": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Acceptance_TaxEndTime.ToString(), TimeHelper.ToTimeType.link_ymdt) + "</td>"); ; break;
                            case "Pt_Date": data.Append("<td>" + TimeHelper.TimeStampToDateTime(model.Pt_Date.ToString(), TimeHelper.ToTimeType.link_ymdt) + "</td>"); ; break;
                            case "Pt_ActualTax": data.Append("<td>" + model.Pt_ActualTax*0.01 + "</td>"); ; break;
                            case "Pt_State": data.Append("<td>" + model.Pt_State + "</td>"); ; break;
                            case "address": data.Append("<td>" + model.address + "</td>"); ; break;
                                   
                        }
                    }
                    data.Append("</tr>");
                }
                data.Append("</table>");
            }
            #endregion

            string sw = ExcelHelper.ExcelTemplate(data.ToString());

            string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
            // 写入到数据流
            return File(System.Text.Encoding.UTF8.GetBytes(sw.ToString()), "application/octet-stream", "一户式纳税情况表_" + fileName + ".xls");

        }
        
        #endregion
    }
}
